Followup to r69776: cache result of extractRequestParams() because it gets called...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 23 Jul 2010 10:15:29 +0000 (10:15 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 23 Jul 2010 10:15:29 +0000 (10:15 +0000)
includes/api/ApiBase.php
includes/api/ApiQuery.php
includes/api/ApiQueryBase.php

index 19779d4..09c9f45 100644 (file)
@@ -479,16 +479,18 @@ abstract class ApiBase {
         * @return array
         */
        public function extractRequestParams( $parseLimit = true ) {
-               $params = $this->getFinalParams();
-               $results = array();
+               if ( !isset( $this->mCachedRequestParams ) ) {
+                       $params = $this->getFinalParams();
+                       $this->mCachedRequestParams = array();
 
-               if ( $params ) { // getFinalParams() can return false
-                       foreach ( $params as $paramName => $paramSettings ) {
-                               $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
+                       if ( $params ) { // getFinalParams() can return false
+                               foreach ( $params as $paramName => $paramSettings ) {
+                                       $this->mCachedRequestParams[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
+                               }
                        }
                }
 
-               return $results;
+               return $this->mCachedRequestParams;
        }
 
        /**
index b86438f..cb7080d 100644 (file)
@@ -489,6 +489,7 @@ class ApiQuery extends ApiBase {
 
        /**
         * Create a generator object of the given type and return it
+        * @param $generatorName string Module name
         */
        public function newGenerator( $generatorName ) {
                // Find class that implements requested generator
index 1a2ddcc..c787dd9 100644 (file)
@@ -47,8 +47,9 @@ abstract class ApiQueryBase extends ApiBase {
        }
 
        /**
-        * Get the cache mode for the data generated by this module. Override this
-        * in the module subclass.
+        * Get the cache mode for the data generated by this module. Override
+        * this in the module subclass. For possible return values and other
+        * details about cache modes, see ApiMain::setCacheMode()
         *
         * Public caching will only be allowed if *all* the modules that supply
         * data for a given request return a cache mode of public.